package testdemo;

import com.baidubce.qianfan.Qianfan;
import com.baidubce.qianfan.model.chat.ChatResponse;
import com.baidubce.qianfan.model.image.Image2TextResponse;
import com.baidubce.qianfan.model.image.Text2ImageResponse;

public class demo1 {
    public static void main(String[] args) {
        // 直接在代码中设置访问密钥和密钥
        String accessKey = "ALTAKtcDh0nQtP40NgZUAmDA4K";
        String secretKey = "57a949833c7b408a81e06959785d90cf";

        Qianfan qianfan = new Qianfan(accessKey, secretKey);
        ChatResponse response = qianfan.chatCompletion()
                .model("ERNIE-4.0-8K-0104") // 使用model指定预置模型
                .addMessage("user", "今天福州的天气怎么样") // 添加用户消息
                .temperature(0.7) // 自定义超参数
                .execute(); // 发起请求
        System.out.println(response.getResult());
    }
}
